<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>赛事管理</title>
	<%@ include file="/view/common/tags.jsp"%>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <meta content="" name="description" />
    <meta content="" name="author" />
<body>
<section class="content">
 	<div class="row"> 
    	<div class="col-md-12">
	     	<div class="box">
	            <div class="box-body">
	               <div class="panel panel-default">
	                    <div class="panel-body" style="padding-bottom:5px;">
	                        <form class="form-horizontal" action="/pubgMatch/list" method="post" id="pubgMatchForm">
	                            <div class="searchMenu">
									<div>
										<label>俱乐部：</label>
										<select cssClass="form-control select" name="wm[CLUB_ID]">
											<option value="">请选择</option>
											<c:if test="${clubList != null && fn:length(clubList) > 0}">
												<c:forEach items="${clubList}" var="pubgClub">
													<option value="${pubgClub.rowId}">${pubgClub.clubName}</option>
												</c:forEach>
											</c:if>
										</select>
									</div>
	                                <div  class="mal10">
	                                    <button type="button"  class="btn btn-primary btn-sm"  onclick="findData()"><span class='glyphicon glyphicon-search'></span>查&nbsp;询</button>
	                                </div>
	                            </div>
	                        </form>
	                    </div>
	                </div>
	                <table class="table-scrollable table table-hover  table-bordered" id="pubgMatchTable" data-striped=true>
	                    <thead>
	                        <tr>
	                            <th data-field="index" data-align="center" data-formatter="indexFormatter" data-sortable="false">序号</th>
								<th data-field="clubName" data-align="center">俱乐部</th>
								<th data-field="matchName" data-align="center">赛事名称</th>
								<th data-field="matchMode" data-align="center">比赛模式</th>
								<th data-field="applyStartTime" data-align="center" data-formatter="timeFormatter_point" >报名时间</th>
								<th data-field="matchStartTime" data-align="center" data-formatter="timeFormatter_point" >比赛时间</th>
								<th data-field="matchType" data-align="center">比赛类型</th>
								<th data-field="roomName" data-align="center">房间名称</th>
								<th data-field="roomPwd" data-align="center">房间密码</th>
								<th data-field="matchPeopleNum" data-align="center">参赛人数</th>
								<th data-field="applyPeopleNum" data-align="center">报名人数</th>
								<th data-field="matchState" data-align="center" data-formatter="matchStateFormatter" >比赛状态</th>
	                            <th data-field="optButton" data-align="center" data-sortable="false" data-formatter="buttonFormatter">操作</th>
	                        </tr>
	                    </thead>
	                </table>
	            </div>
	        </div>
		</div>
	</div>
	<input type="hidden" id="msgg"  value="${msg}">
	<input type="hidden" id="code"  value="${code}">
</section>
   <%@ include file="/view/common/footer.jsp"%>
</body>
<script>
    var msgg = $("#msgg").val();
    var code = $("#code").val();
    $(function(){
        if( code== 1) {
            layer.msg(msgg);
        }
    });

    function matchStateFormatter(value, row) {
        var html = "";
        if (row.matchState == "10") {
            html = "<span class='text-warning'>未开始 </span>&nbsp;&nbsp;&nbsp;&nbsp;";
            return html;
        } else if (row.matchState == "30") {
            html = "<span class='text-danger'>报名中 </span>&nbsp;&nbsp;&nbsp;&nbsp;";
            return html;
        } else if (row.matchState == "50") {
            html = "<span class='text-danger'>比赛中 </span>&nbsp;&nbsp;&nbsp;&nbsp;";
            return html;
        } else if (row.matchState == "70") {
            html = "<span class='text-success'>已结束 </span>&nbsp;&nbsp;&nbsp;&nbsp;";
            return html;
        } else if (row.matchState == "80") {
            html = "<span class='text-success'>已取消 </span>&nbsp;&nbsp;&nbsp;&nbsp;";
            return html;
        }
    }

    //操作按钮
    function buttonFormatter(value, row,index) {
    }

    $(function(){
        $("#pubgMatchTable").bootstrapTable({
            url: JSSYSMANAGERV1 + "/pubgMatch/listPubgMatch.json",
            method:"get",
            pagination:true,
            sidePagination:"server",
            queryParams: function(params) {
                return $.extend({}, params, parseJson(decodeURIComponent($("#pubgMatchForm").serialize())));
            }
        });
    })
    function findData(){
        $("#pubgMatchTable").bootstrapTable("refresh",{} );
    }
</script>
</html>